<?php
declare (strict_types = 1);

namespace app\api\controller\person;

use app\api\controller\Base;
use app\common\service\person\MycouponService;

class MyCoupon extends Base
{

    /**
     * Author:Yingbo Sun
     * 我的优惠卷
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function couponList()
    {
        $uid = $this->request->uid;
        $status = $this->request->get('status');
        if (empty($uid) && empty($status)){
            $data = ['code' => 400,'message' => '参数错误','data' => []];
            return $this->res($data);
        }
        $data = MycouponService::coupon($uid,$status);
        return $this->res($data);
    }


    public function couponOrder()
    {
        $uid = $this->request->uid;
        $data = MycouponService::couponByOrder($uid);
        return $this->res($data);
    }
}
